DIST_NAME=textplugin
UTILS= ${SRC_DIR}/Utils
TEXT_PLUGIN= ${SRC_DIR}/TextPlugin

OBJS= ${TEXT_PLUGIN}/TextReader.o ${TEXT_PLUGIN}/PageManager.o \
	${TEXT_PLUGIN}/LuaParser.o ${TEXT_PLUGIN}/StreamManager.o \
	${UTILS}/Fonts/FontManager.o ${UTILS}/DebugStream.o \
	${UTILS}/HyphenationManager.o ${UTILS}/Hyphenation.o

ifdef DEVKIT
OBJS += TextPlugin.o
else
OBJS += TextPluginN.o
endif

#OBJS= test_plugin.o

FLTK_INC=../../v3sdk-1.2.1/include/flnx
NANOX_INC=../../v3sdk-1.2.1/include/nanox
SDK_INC=../../v3sdk-1.2.1/include
SDK_LIBS=../../v3sdk-1.2.1/${TARGET}/lib

EXEC= libhltxt.so
CONFIG_FILES= textplugin.lua

#DEBUG= -g2
DEBUG=-O2

CFLAGS= ${DEBUG} -W -Wall -D NANO_X -I../ -I./ -I${SDK_INC} -I${FLTK_INC} -I${NANOX_INC}

CXXFLAGS= ${DEBUG} -W -Wall -D NANO_X -I../include -I../ -I${SDK_INC} -I${LUAINC} -I${FLTK_INC} -I${NANOX_INC}

TXTLIBS= $(LIBS) -L/root/$(hosttype)-libs  -lfreetype -lm  \
                    -ldl

LDFRAGS = ${LUALIBS} -L${SDK_LIBS} ${TXTLIBS}

.PHONY: all
.PHONY: dist

all:$(EXEC)

$(EXEC):$(OBJS)
	$(CXX) $(CXXFLAGS) -shared -o $(EXEC) $(OBJS) ${LDFRAGS}

#-shared 
strip: all
	$(STRIP) $(EXEC)

install: all
	cp $(EXEC) ${SDK_LIBS}/

clean:
	rm -rf $(OBJS) $(EXEC)

dist: strip
	tar cfz ${DIST_NAME}.${TARGET}.tgz ${EXEC} ${CONFIG_FILES}
